package com_3;

import java.util.function.Consumer;

public class TestDemo2 {
    public static void main(String[] args) {
        String[]arr={"诸葛亮,45","曹操,46","孙权,35"};getArray(arr, s-> System.out.print("姓名是"+s.split(",")[0]), s-> System.out.println("年龄"+Integer.parseInt(s.split(",")[1])));
  ; }
  public static  void getArray(String[] arr, Consumer<String> con1, Consumer<String> con2) {
        for (String s : arr) {
            con1.andThen(con2).accept(s);
        }
    }
}
